package com.suptrack.web.servlet;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.suptrack.entity.Car;
import com.suptrack.entity.Zone;
import com.suptrack.service.ZoneService;

/**
 * Servlet implementation class removeZoneServlet
 */
@WebServlet("/RegisteredContent/removeZone")
public class removeZoneServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
  @EJB
  ZoneService zoneservice;
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		long id = Long.parseLong(request.getParameter("id2"));
		Zone zone = zoneservice.getZoneByIdService(id);
		zoneservice.deleteZoneService(zone);
		response.sendRedirect(request.getServletContext().getContextPath()+"/RegisteredContent/ManageZone");
	}

}
